/**
 * 
 */
package com.surthi.app.magazine.model;

import java.io.FileInputStream;

import org.apache.commons.lang3.StringUtils;

/**
 * @author Vdevi
 *
 */
public class Document {
	
	private String year;
	private String month;
	private String fileName;
	private FileInputStream inStream;
			
	private Document(final String year, final String month, final String fileName,final FileInputStream inStream){
		super();
		this.year = year;
		this.month = month;
		this.fileName = fileName;
		this.inStream = inStream;
	}
	
	public static Document getInstance(final String year, final String month, final String fileName,final FileInputStream inStream ){
		if (StringUtils.isBlank(year))throw new IllegalArgumentException("Year can not be blank");
		if (StringUtils.isBlank(month))throw new IllegalArgumentException("Month can not be blank");
		if (StringUtils.isBlank(fileName))throw new IllegalArgumentException("File name can not be blank");
		if (inStream == null) throw new IllegalArgumentException("Source to read file (Input stream) can not be null");
		return new Document(year, month, fileName, inStream);
	}
	
	public String getYear() {
		return year;
	}
	public void setYear(String year) {
		this.year = year;
	}
	public String getMonth() {
		return month;
	}
	public void setMonth(String month) {
		this.month = month;
	}
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	public FileInputStream getInStream() {
		return inStream;
	}
	public void setInStream(FileInputStream inStream) {
		this.inStream = inStream;
	}

}
